{// 引入标签库 }
<tagLib name="html" />
<include file="Public:header" />
<php>
	function get_cate_name($cate_id)
	{
		return M("ArticleCate")->where("id=".$cate_id)->getField("title");
	}
	function preview($cate_id)
	{
	return "<a href=\"javascript:article_show('".$cate_id."')\">预览</a>";
	}
</php>
<script>
	function article_show(cate_id){
		window.open(APP_ROOT+"/wap/index.php?ctl=settings&act=article_show&cate_id="+cate_id);
	}

    function del_article(id)
    {
        if(!id)
        {
            idBox = $(".key:checked");
            if(idBox.length == 0)
            {
                alert(LANG['DELETE_EMPTY_WARNING']);
                return;
            }
            idArray = new Array();
            $.each( idBox, function(i, n){
                idArray.push($(n).val());
            });
            id = idArray.join(",");
        }
        if(confirm(LANG['CONFIRM_DELETE']))
            $.ajax({
                url: ROOT+"?"+VAR_MODULE+"="+MODULE_NAME+"&"+VAR_ACTION+"=delete&id="+id,
                data: "ajax=1",
                dataType: "json",
                success: function(obj){
                    alert(obj.info);
                    func();
                    function func(){
                        if(obj.status==1){
                            location.href=location.href;
                        }
                    }
                }
            });
    }
</script>
<div class="main">
<div class="main_title_list"><div class="list-line-ico"></div>{$main_title}</div>
<div class="search_row">
	<form name="search" action="__APP__" method="get">
		分类：<select name="cate_id" style="width: 100px">
				<option value="0" >全部</option>
				<foreach name="cate_list" item="cate_item">
					<option value="{$cate_item.id}" <if condition="$_REQUEST['cate_id'] eq $cate_item['id']">selected="selected"</if>>{$cate_item.title}</option>
				</foreach>
			</select>名称：<input type="text" class="textbox" name="title" value="{:trim($_REQUEST['title'])}" /><input type="hidden" value="Article" name="m" /><input type="hidden" value="index" name="a" /><input type="submit" class="button" value="{%SEARCH}" />
	</form>
</div>
<html:list
	id="dataTable"
	style="dataTable"
	name="article"
	checkbox="true"
	action="true"
	datasource="list"
	show="id:{%ID}|50px,title:{%ARTICLE_TITLE}:edit,cate_id|get_cate_name:{%CATE_TREE},is_effect|get_is_effect=$article['id']:{%IS_EFFECT},create_time|to_date:{%CREATE_TIME},update_time|to_date:{%UPDATE_TIME},sort|get_sort=$article['id']:{%SORT},click_count:{%CLICK_COUNT}"
	actionlist="edit:{%EDIT}, del_article:{%DEL},cate_id|preview" />
	<table class="dataTable">
		<tbody>
			<td colspan="9">
				<input type="button" class="button button-add" value="{%ADD}" onclick="add();" />
				<input type="button" class="button button-del" value="{%DEL}" onclick="del_article();" />
			</td>
		</tbody>
	</table>
<div class="page">{$page}</div>
</div>
<include file="Public:footer" />